<!DOCTYPE html>
<html>
{include file="public/head"}

<body>
    {include file="contest/contest-nav"}
    <br/>
    <div class="layui-form" style="text-align:center;">
        <div class="layui-form-item">
            <input type="radio" name="select" value='0' lay-filter="lzq" title="展示用户名">
            <input type="radio" name="select" value='1' lay-filter="lzq" title="展示昵称" checked>
        </div>
    </div>
    </div>
    <div style="width: 100%;">
        <table class="layui-table" lay-even lay-skin="nob">
            <colgroup>
                <col width="60">
                <col width="">
                <col width="">
                <col width=""> {foreach name="num" item ="v"}
                <col width=""> {/foreach}
            </colgroup>
            <thead>
                <tr class="layui-bg-black">
                    <th style="text-align:center">排名</th>
                    <th style="text-align:center" class="nyoj-user-id">用户名</th>
                    <th style="text-align:center" class="nyoj-user-name">昵称</th>
                    <th style="text-align:center">题量</th>
                    <th style="text-align:center">时间</th>
                    {foreach name="num" item="v"}
                    <th style="text-align:center"><a href="{:url('web/contest/problem?cid='.$list[0]['contest_id'] .'&num=' . chr($v.num+65))}" class="fly-link fly-joinad">{:chr($v.num+65)}</a></th>
                    <!-- <th><a href="" class="fly-link fly-joinad">{:chr(65 + $v['num'])}</a></th> -->
                    {/foreach}
                </tr>
            </thead>
            <tbody>
                {foreach name="user" item="v" key="k"}
                <tr align="center">
                    <td>{$k+1}</td>
                    <td class="nyoj-user-id" >
                        <a href="{:url('web/account/info?user_id=' . $v.user_id)}" class="{if condition="($user_id==$v.user_id)"}myself-block{/if} fly-link fly-joinad">
                            {$v.user_id}</a></td>
                    <td class="nyoj-user-name"> <a href="{:url('web/account/info?user_id=' . $v.user_id)}" class="{if condition="($user_id==$v.user_id)"}myself-block{/if} fly-link fly-joinad">{:htmlspecialchars($v.nick)}</a></td>
                    <td>{$v.count_ac}</td>
                    <td>{$v.time}</td>
                    {foreach name="num" item="col" key="c"} 
                    {if condition="($is_first_ac[$v['user_id']][$c]==true)"}
                    <td style="background: #008800; color:white">
                        {elseif condition="($is_ac[$v['user_id']][$c])"}
                        <td style="background: #A9F5AF">
                            {elseif condition="(isset($last_submit_times) && $last_submit_times[$v['user_id']][$c] >0)"}
                            <td style="background: #F0AD4E;">
                            {elseif condition="($submit_times[$v['user_id']][$c] >0)"}
                            <td style="background: #FFDDDD;">
                                {else /}
                                <td>
                                    {/if}
                                    <?php
                    if($is_ac[$v['user_id']][$c])
                    echo $problem_time[$v['user_id']][$c];

                    if(isset($last_submit_times)&&$last_submit_times[$v['user_id']][$c] >0)
                        {
                            echo '<p style="text-align: center;color:white;">' . '(';
                            if(isset($submit_times)&&$submit_times[$v['user_id']][$c] >0)
                            echo '-' . $submit_times[$v['user_id']][$c];
                            echo '+' . $last_submit_times[$v['user_id']][$c] .  ')</p>';
    }
                    else if(isset($submit_times)&&$submit_times[$v['user_id']][$c] >0)
                    echo '<p style="text-align: center;">(-'. $submit_times[$v['user_id']][$c] . ')</p>';


                    ?>
                                </td>
                                {/foreach}
                </tr>
                {/foreach}
            </tbody>
        </table>
    </div>
    </div>
    {include file="public/foot"}
	{include file="contest/post-notice"}
</body>
<script>
layui.use(['jquery', 'form'], function() {
    var $ = layui.jquery;
    var form = layui.form;
    $('.nyoj-user-id').addClass('layui-hide');
    $('.nyoj-user-name').removeClass('layui-hide');
    form.on('radio(lzq)', function(data) {
        if (data.value == '0') {
            $('.nyoj-user-name').addClass('layui-hide');
            $('.nyoj-user-id').removeClass('layui-hide');
        } else {
            $('.nyoj-user-id').addClass('layui-hide');
            $('.nyoj-user-name').removeClass('layui-hide');
        }

    });
});
</script>

</html>